#include "stm32f10x.h"                  // Device header            
//extern int16_t Encoder_R_EXTI,Encoder_L_EXTI;
//extern float speed2,speed1;
//float L1,R2;
//extern uint8_t s;

void Timer_Init(void)
{
	RCC_APB1PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
	
	TIM_InternalClockConfig(TIM1);
	TIM_TimeBaseInitTypeDef TIM1_TimeBaseInitstructure;
	TIM1_TimeBaseInitstructure.TIM_ClockDivision=TIM_CKD_DIV1 ;
	TIM1_TimeBaseInitstructure.TIM_CounterMode=TIM_CounterMode_Up  ;
	TIM1_TimeBaseInitstructure.TIM_Period=65535-1;//zhidongcz
	TIM1_TimeBaseInitstructure.TIM_Prescaler=72-1;//pscyufpqi
	TIM1_TimeBaseInitstructure.TIM_RepetitionCounter=0;//chongfujsqi
	TIM_TimeBaseInit(TIM1,&TIM1_TimeBaseInitstructure);
//	TIM_ClearFlag(TIM1,TIM_FLAG_Update);//huizaizhouyic
//	TIM_ITConfig(TIM1,TIM_IT_Update,ENABLE);
	
//	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
//	
//	NVIC_InitTypeDef NVIC_InitStruct;
//	NVIC_InitStruct.NVIC_IRQChannel=TIM1_IRQn;
//	NVIC_InitStruct.NVIC_IRQChannelCmd=ENABLE;
//	NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority=2;//qinagzhan
//	NVIC_InitStruct.NVIC_IRQChannelSubPriority=2;//xiangying
//	NVIC_Init(&NVIC_InitStruct);
//	TIM_Cmd(TIM1, ENABLE);
};
//void TIM1_IRQHandler(void)
//{
//	if(TIM_GetITStatus(TIM1,TIM_IT_Update)==SET)
//	{
//	
//		TIM_ClearITPendingBit(TIM1,TIM_IT_Update);
//	}
//}


